$(function () {
	   
    $("#jqGrid").jqGrid({
        url: baseURL + 'fund/hist',
        datatype: "json",
        colModel: [
			{ label: 'ID', name: 'id', width: 0, key: true, hidden:true},
			{ label: '用户', name: 'phone', index: 'phone', width: 96 , sortable:false},
			{ label: 'IMU/锁定', name: 'money', sortable:false, width: 80 , formatter: function(value, options, row)
                {
                    return ((null == row.money || undefined == row.money) ? 0 : row.money) + "/" + ((null == row.lockMoney || undefined == row.lockMoney) ? 0 : row.lockMoney);
                }
            },
            { label: '易买宝/锁仓', name: 'bj', sortable:false, width: 80 , formatter: function(value, options, row)
                {
                    return ((null == row.bj || undefined == row.bj) ? 0 : row.bj) + "/" + ((null == row.lockbj || undefined == row.lockbj) ? 0 : row.lockbj);
                }
            },
            { label: '交易员', name: 'btc', sortable:false, width: 80 , formatter: function(value, options, row)
                {
                    return ((null == row.btc || undefined == row.btc) ? 0 : row.btc);
                }
            },
            { label: '智多星/锁仓', name: 'fcg', sortable:false, width: 80 , formatter: function(value, options, row)
                {
                    return ((null == row.fcg || undefined == row.fcg) ? 0 : row.fcg) + "/" + ((null == row.lockfcg || undefined == row.lockfcg) ? 0 : row.lockfcg);
                }
            },
            { label: '俱乐部/锁仓', name: 'hbc', sortable:false, width: 80 , formatter: function(value, options, row)
                {
            		if(null == value || undefined == value) return "未知";
            	
                	if(value < 10 ) return "非俱乐部会员";
                	if(value>=10 && value<200) return "白银卡";
                    if(value>=200 && value<500) return "黄金卡";
                    if(value>=500 && value<1000) return "钻石卡";
                    if(value>=1000 && value<2000) return "白金卡";
                    if(value>=2000) return "黑金卡";
                }
            },
            { label: 'KCT/锁仓', name: 'ico', sortable:false, width: 80 , formatter: function(value, options, row)
                {
                    return ((null == row.ico || undefined == row.ico) ? 0 : row.ico) + "/" + ((null == row.lockico || undefined == row.lockico) ? 0 : row.lockico);
                }
            },
            { label: 'GET/锁仓', name: 'eth', sortable:false, width: 80  , formatter: function(value, options, row)
                {
                    return ((null == row.eth || undefined == row.eth) ? 0 : row.eth) + "/" + ((null == row.locketh || undefined == row.locketh) ? 0 : row.locketh);
                }
            },
            { label: '合赢分', name: 'fen', sortable:false, width: 80 },
            { label: '贝壳/锁仓', name: 'cowry', sortable:false, width: 80 , formatter: function(value, options, row)
                {
                    return ((null == row.cowry || undefined == row.cowry) ? 0 : row.cowry) + "/" + ((null == row.lockcowry || undefined == row.lockcowry) ? 0 : row.lockcowry);
                }
            },
			{ label: '用户钱包地址', name: 'moneyAddress', sortable:false, width: 80 },
			{ label: '创建时间', name: 'timeCreate', sortable:false, width: 80 }
        ],
		viewrecords: true,
        height: 385,
        rowNum: 20,
		rowList : [10,20,30,50,100,200],
        rownumbers: false, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.pageNum",
            total: "page.pages",
            records: "page.total"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });
    jQuery("#jqGrid").jqGrid('navGrid','#jqGrid',{edit:false,add:false,del:false});
});


var vm = new Vue({
	el:'#rrapp',
	data:{
		q:{
			key: null
		},
		showList: true,
		dto: {}
	},
	methods: {
		query: function () {
			vm.reload();
		},
		reload: function (event) {
			var _postData = $("#jqGrid").jqGrid('getGridParam','postData');
			_postData['p'] = $("#phone").val();
			var page = $("#jqGrid").jqGrid('getGridParam','page');
			$("#jqGrid").jqGrid('setGridParam',{ 
                page:page
            }).trigger("reloadGrid");
		}
	}
});
